package com.hiyee.utils;

import com.github.pagehelper.PageInfo;
import com.hiyee.response.PagedGridResult;

import java.util.List;

/**
 * 统计返回列表数据工具类
 *
 * @author WangBin
 */
public class PageGridResultUtil {

    public static PagedGridResult getPageGridResult(List<?> dataList, Integer page) {
        PageInfo<?> pageInfo = new PageInfo<>(dataList);
        PagedGridResult pagedGridResult = new PagedGridResult();
        pagedGridResult.setPage(page);
        pagedGridResult.setList(dataList);
        pagedGridResult.setTotalPage(pageInfo.getPages());
        pagedGridResult.setTotal((int)pageInfo.getTotal());
        return pagedGridResult;
    }
}
